package com.nova.android.tvlauncher.ext

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.nova.android.tvlauncher.R
import com.shudong.lib_base.ext.appContext
import com_github_lib_base.ext.dimenValue
import jp.wasabeef.glide.transformations.RoundedCornersTransformation

private val defaultPic = R.drawable.rectangle_solffffff

fun ImageView.loadGlideRadius(
    any: Any,
    radius: Int = com.codeZeng.lib_dimen.R.dimen.qb_px_5.dimenValue()
) {
    Glide.with(appContext)
        .load(any)
        .placeholder(defaultPic)  // 设置占位符
        .error(defaultPic)        // 设置错误图片
        .transform(
            RoundedCornersTransformation(
                radius,
                0
            )
        ) // 设置圆角半径
        .into(this)
}